package com.wphmoon.lesson.common.typehandler;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import org.apache.ibatis.type.TypeHandler;

import com.wphmoon.lesson.domain.MyTask;

@MappedTypes(value = MyTask.class)
public class MyTaskTypeHandler implements TypeHandler<MyTask> {

	@Override
	public void setParameter(PreparedStatement ps, int i, MyTask parameter, JdbcType jdbcType) throws SQLException {
		System.out.println("into MyTaskTypeHandler");
	}

	@Override
	public MyTask getResult(ResultSet rs, String columnName) throws SQLException {
		return rs.getObject(columnName, MyTask.class);
	}

	@Override
	public MyTask getResult(ResultSet rs, int columnIndex) throws SQLException {
		return rs.getObject(columnIndex, MyTask.class);
	}

	@Override
	public MyTask getResult(CallableStatement cs, int columnIndex) throws SQLException {
		return cs.getObject(columnIndex, MyTask.class);
	}

 
}
